package com.user.controller;


import com.common.domain.entity.Point;
import com.common.domain.entity.ResponseResult;
import com.common.enums.AppHttpCodeEnum;
import com.common.service.ExchangeLogService;
import com.common.service.PointService;
import com.common.util.RedisCache;
import com.common.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
public class PointController {
    @Autowired
    private PointService pointService;

    @GetMapping("getUserPointInfo")
    public ResponseResult userInfo(){
        return pointService.getUserPointInfo();
    }

    @PostMapping("addUserPointLog")
    public ResponseResult addUserPointLog(@Valid @RequestBody Point point){
        return pointService.addUserPointLog(point);
    }

    @GetMapping("getUserPointDetail")
    public ResponseResult getUserPointDetail(Long pageNum, Long pageSize){
        return pointService.getUserPointDetail( pageNum,  pageSize);
    }

    @GetMapping("exchange")
    public ResponseResult exchange(Long id){
        return pointService.exchange(id);
    }
}
